package topdown;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import junit.framework.Assert;

public class CalculatorTest {
	
	@BeforeClass
	public static void sebelumTest(){
		System.out.println("sebelumSemuaTest");
	}
	
	@AfterClass
	public static void setelahTest(){
		System.out.println("setelahSemuaTest");
	}
	
	@Before
	public void sebelumMasing2Test(){
		System.out.println("sebelum masing masing test");
	}
	
	@After
	public void setelahMasing2Test(){
		System.out.println("setelah masing masing test");
	}
	
	@Test
	public void tambah(){
		Calculator c = new Calculator();
		
		Integer x = 10;
		Integer y = 15;
		
		Integer hasil = c.tambah(x,y);
		Assert.assertEquals(new Integer(25), hasil);
		System.out.println("test tambah");
	}
	
	@Test
	public void kurang(){
		Calculator c = new Calculator();
		
		Integer x = 10;
		Integer y = 5;
		
		Integer hasil = c.kurang(x,y);
		Assert.assertEquals(new Integer(5), hasil);
		System.out.println("test kurang");
	}
	
	@Test
	public void kali(){
		Calculator c = new Calculator();
		
		Integer x = 10;
		Integer y = 5;
		
		Integer hasil = c.kali(x,y);
		Assert.assertEquals(new Integer(50), hasil);
		System.out.println("test kali");
	}
	
	@Test
	public void bagi(){
		Calculator c = new Calculator();
		
		Double x = 10d;
		Double y = 0d;
		
		Double hasil = c.bagi(1d,0d);
		Assert.assertEquals(new Integer(5), hasil);
		System.out.println("test bagi");
	}

}
